<?php
class Wap_Models_BannerModel extends Zend_Db_Table_Abstract{
	protected $_name="banner";
	protected $_primary="id";
	
function getBanner(){
		$db = Zend_Db_Table::getDefaultAdapter();
		$mySql = $db->select()
					->from(array("b"	=> $this->_name),array())
					->join(array("p"	=> "product"), "b.product_id = p.id",array('id','poster'))
					->order("RAND()");
		$result = $db->fetchRow($mySql);
		return $result;
	}
function getBannerList($number){
		$db = Zend_Db_Table::getDefaultAdapter();
		$mySql = $db->select()
					->from(array("b"	=> $this->_name),array())
					->join(array("p"	=> "product"), "b.product_id = p.id",array('id','poster'))
					->limit($number)
					->order("RAND()");
		$result = $db->fetchAll($mySql);
		return $result;
	}
}